home *** CD-ROM | disk | FTP | other *** search
- Path: news.nstn.ca!news
- From: nstn181a@fox.nstn.ca (Pierre G. Boutquin)
- Newsgroups: comp.lang.c++
- Subject: Re: Q:order of evaluation
- Date: Fri, 26 Jan 96 22:12:53 -0400
- Organization: Nova Scotia Technology Network
- Message-ID: <4ec59t$f3n@news.nstn.ca>
- NNTP-Posting-Host: toronto-ts-25.nstn.ca
-
- In <4eb6kq$ksf@gazette.tandem.com>, yun_yeogirl writes:
- >Michael M Rubenstein wrote :
- >
- > [Example:
- > i = v[i++]; // the behavior is undefined
- > i = 7,i++,i++; // `i' becomes 9
- >
- > i = ++i + 1; // the behavior is undefined
- > i = i + 1; // the value of 'i' is incremented
- >
- >The first and third statement seem clear to me. I don't see why they are
- >undefined. I guess you made a typo here. Maybe you meant :
- >
- > i + v[i++] and i + (++i + 1).
- >
- >If I am wrong, please enlighten me.
-
- You _are_ wrong. They seem clear, but are undefined _by convention_.
- i = v[i++]; is given in ARM as an example at the start of Chapt. 5.
-
- Pierre.
-